import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: ' 下发人',
    align: "center",
    dataIndex: 'userName'
  },
  {
    title: '设备编号',
    align: "center",
    dataIndex: 'deviceCode'
  },
  {
    title: '维保描述',
    align: "center",
    dataIndex: 'patrolDesc'
  },
  {
    title: ' 维保日期',
    align: "center",
    dataIndex: 'patrolTime'
  },
  {
    title: ' 状态',
    align: "center",
    dataIndex: 'state',
    customRender: (text) => {
  
      let re = ''
      if (text.value == 0) {
        re = '未进行'
  
      } else if (text.value == 1) {
        re = '进行中'
      } else if (text.value == 2) {
        re = '已完成'
      }
      return re
    }
  },
  {
    title: '创建日期',
    align: "center",
    dataIndex: 'createTime'
  },
  {
    title: '更新日期',
    align: "center",
    dataIndex: 'updateTime'
  },
];

//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: "设备编号",
    field: 'deviceCode',
    component: 'Input',
    colProps: {span: 6},
  },
];

//表单数据
export const formSchema: FormSchema[] = [
  {
    label: ' 下发人',
    field: 'userName',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入 下发人!'},
             ];
    },
  },
  {
    label: '设备编号',
    field: 'deviceCode',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入设备编号!'},
             ];
    },
  },
  {
    label: '维保描述',
    field: 'patrolDesc',
    component: 'InputTextArea',
  },
  {
    label: ' 维保日期',
    field: 'patrolTime',
    component: 'DatePicker',
    componentProps: {
      showTime: true,
      valueFormat: 'YYYY-MM-DD HH:mm:ss'
    },
  },
	// TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];
